package com.kaifamiao.www.demo.Do28;

public class Student {
    private String name;
    private int age;
    private String hobby;
    private int no;
    private Boy boyBoyfriend;
   /* public void show(){
        System.out.println("s");
    }*/
    public Student(String name,int age,String hobby){
        this.name = name;
        this.age = age;
        this.hobby = hobby;

    }
    public Student(String name,int age,String hobby,int no){
        this.name = name;
        this.age = age;
        this.hobby = hobby;
        this.no = no;
    }
    public void setBoyFriend(Boy boyBoyfriend){
     this.boyBoyfriend = boyBoyfriend;
    }
    public Boy getBoyBoyfriend(){
        return this.boyBoyfriend;
    }
    @Override
    public String toString(){
        return "Student:name="+this.name+",age="+this.age+",hobby="+this.hobby+
                ",boyFriend="+boyBoyfriend.toString();
    }
    @Override
    public Object clone() throws CloneNotSupportedException{

        Student clone = (Student) super.clone();
        clone.setBoyFriend((Boy) clone.boyBoyfriend.clone());
        return clone;
    }
    /**
     * 两个 Student 对象相等
     * @param obj
     * @return
     *
     * 它是自反的：对于任何非空引用值 x，x.equals(x)都应该返回 true。
     * 它是对称的：对于任何非空引用值 x和 y，当且仅当 返回时才x.equals(y) 应该返回 true. y.equals(x)true
     * 它是可传递的：对于任何非空引用值 x、y和z，如果 x.equals(y)返回true和 y.equals(z)返回true，则 x.equals(z)应该返回true。
     * 它是一致的：对于任何非空引用值 x和y，多次调用 x.equals(y)一致返回true 或一致返回false，前提equals是没有修改对象比较中使用的信息。
     * 对于任何非空引用值x， x.equals(null)应该返回false。
     *
     *  name 一样
     *  age  一样
     *  hobby 一样
     *  no  一样
     */
    
}
